package com.itheima.blog.admin.controller;

import com.itheima.api.client.Comment.CommentClient;
import com.itheima.common.domain.PageResDto;
import com.itheima.common.domain.R;
import com.itheima.common.domain.dto.CommentPageDto;
import com.itheima.common.domain.po.ResComment;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.lang.annotation.*;
import java.util.List;


@RestController
@RequestMapping("/admin")
@RequiredArgsConstructor
public class AdminCommentController {
    private final CommentClient commentClient;
    @ApiOperation("消息管理分页")
    @PostMapping("/comment/page")
    public PageResDto<ResComment> commentPage(@RequestBody CommentPageDto commentPageDto){
        PageResDto<ResComment> commentPages = commentClient.getCommentList(commentPageDto);
        return commentPages;
    }

    @ApiOperation("消息管理删除")
    @DeleteMapping("/comment")
    public void deleteCommentByIds(List<Integer> ids){
        commentClient.deleteCommentByIds(ids);
    }
}
